package com.itheima.entity;

import java.util.*;

public class Poker {

    private String roomid;
    private Map<Integer, List<Integer>> map = new HashMap<>();
    private Integer count = 0;
    private Map<Integer, Integer> store = new HashMap<>();
    private List<Integer> bottom = new ArrayList<>();
    private List<Integer> order = new ArrayList<>();

    public Poker(String roomid, String sid) {
        this.roomid = roomid;
        List<Integer> init = init();
        map.put(Integer.parseInt(sid), init);
        order.add(Integer.parseInt(sid));
        count++;
    }

    public List<Integer> getOrder() {
        return order;
    }

    public void setOrder(List<Integer> order) {
        this.order = order;
    }

    public List<Integer> init() {
        store.put(1, 4);
        store.put(2, 4);
        store.put(3, 4);
        store.put(4, 4);
        store.put(5, 4);
        store.put(6, 4);
        store.put(7, 4);
        store.put(8, 4);
        store.put(9, 4);
        store.put(10, 4);
        store.put(11, 4);
        store.put(12, 4);
        store.put(13, 4);
        store.put(14, 1);
        store.put(15, 1);
        List<Integer> list = new ArrayList<>();
        Random random = new Random();
        while (list.size() < 17) {
            int i = random.nextInt(15) + 1;
            Integer integer = store.get(i);
            if (integer > 0) {
                store.put(i, integer - 1);
                list.add(i);
            }
        }
        return list;
    }

    public List<Integer> getBottom() {
        return bottom;
    }

    public void setBottom(List<Integer> bottom) {
        this.bottom = bottom;
    }

    @Override
    public String toString() {
        return "Poker{" +
                "roomid='" + roomid + '\'' +
                ", map=" + map +
                '}';
    }

    public String getRoomid() {
        return roomid;
    }

    public void setRoomid(String roomid) {
        this.roomid = roomid;
    }

    public Map<Integer, List<Integer>> getMap() {
        return map;
    }

    public void setMap(Map<Integer, List<Integer>> map) {
        this.map = map;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public Map<Integer, Integer> getStore() {
        return store;
    }

    public void setStore(Map<Integer, Integer> store) {
        this.store = store;
    }
}
